import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CityRegionVO, CityRegionForm, CityRegionQuery } from '@/api/system/cityRegion/types';

/**
 * 查询地址信息列表
 * @param query
 * @returns {*}
 */

export const listCityRegion = (query?: CityRegionQuery): AxiosPromise<CityRegionVO[]> => {
    return request({
        url: '/system/cityRegion/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询地址信息详细
 * @param id
 */
export const getCityRegion = (id: string | number): AxiosPromise<CityRegionVO> => {
    return request({
        url: '/system/cityRegion/' + id,
        method: 'get'
    });
};

/**
 * 新增地址信息
 * @param data
 */
export const addCityRegion = (data: CityRegionForm) => {
    return request({
        url: '/system/cityRegion',
        method: 'post',
        data: data
    });
};

/**
 * 修改地址信息
 * @param data
 */
export const updateCityRegion = (data: CityRegionForm) => {
    return request({
        url: '/system/cityRegion',
        method: 'put',
        data: data
    });
};

/**
 * 删除地址信息
 * @param id
 */
export const delCityRegion = (id: string | number | Array<string | number>) => {
    return request({
        url: '/system/cityRegion/' + id,
        method: 'delete'
    });
};
